import React from "react";
import "./index.scss";
import { Button, Form, Input } from "antd";
import { UserSwitchOutlined, LockOutlined } from "@ant-design/icons";
import { useNavigate } from "react-router-dom";

export default function index() {
  const navigate = useNavigate();

  // 点击登录按钮
  const onFinish = () => {
   
    // 请求数据
    // 跳转到 首页
    navigate('/home')
  };

  return (
    <div className="bg">
      <div className="login">
        <Form name="basic" onFinish={onFinish}>
          <Form.Item
            name="account"
            rules={[
              {
                required: true,
                message: "请输入您的账号",
              },
            ]}
          >
            <Input placeholder="请输入账号" prefix={<UserSwitchOutlined />} />
          </Form.Item>

          <Form.Item
            name="password"
            rules={[
              {
                required: true,
                message: "请输入您的密码",
              },
            ]}
          >
            <Input.Password
              prefix={<LockOutlined />}
              placeholder="请输入密码"
            />
          </Form.Item>

          <Form.Item>
            <Button block type="primary" htmlType="submit">
              登录
            </Button>
          </Form.Item>
        </Form>
      </div>
    </div>
  );
}
